﻿using GloboTicketAdmin.API.Models.Domain;
using GloboTicketAdmin.API.Repository;
using GloboTicketAdmin.API.Services.IService;
using SqlSugar;

namespace GloboTicketAdmin.API.Services
{
    public class CategoryService : BaseRepository<CategoryModel>, ICategoryService
    {
        public CategoryService(ISqlSugarClient db):base(db) { }
        public int AddCategory(List<CategoryModel> categorys)
        {
            return Insert(categorys);
        }

        public int DeleteCategoryById(string id)
        {
            return Delete(id);
        }

        public List<CategoryModel> GetAllCategories()
        {
            return GetAll();
        }

        public CategoryModel GetCategoryById(string id)
        {
            return GetCategoryById(id);
        }

        public int InsertCategory(CategoryModel model)
        {
            return Insertable(model).ExecuteReturnIdentity();
        }

        public int UpdateCategoryById(CategoryModel model, bool ignoreNullColumns = false)
        {
            return Update(model, ignoreNullColumns);
        }
    }
}
